package {{packageName}};

import com.github.houbb.data.factory.core.util.DataUtil;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import javax.validation.Valid;
{{#imports}}
{{.}}
{{/imports}}

@RestController
@RequestMapping("{{baseUrl}}")
@Api(tags = "{{{tagName}}}")
public class {{apiName}}{

{{#methods}}
    @ApiOperation(value = "{{summary}}", notes = "{{summary}}")
    @{{httpMethod}}Mapping("{{url}}")
    public {{{response}}} {{methodName}}({{#bodyJsonVar}}@Valid @RequestBody {{{className}}} {{fieldName}}{{/bodyJsonVar}}{{#multiVars}}{{#file}}@RequestPart("{{fieldName}}") MultipartFile {{fieldName}}{{{split}}}{{/file}}{{^file}} @RequestParam(name = "{{fieldName}}" ,required = {{required}}) {{{fieldType}}} {{fieldName}}{{{split}}}{{/file}}{{/multiVars}}{{#pathVars}}@PathVariable(name = "{{fieldName}}" ,required = {{required}}) {{{fieldType}}} {{fieldName}}{{{split}}}{{/pathVars}}{{#urlVars}}@RequestParam(name = "{{fieldName}}" ,required = {{required}}) {{{fieldType}}} {{fieldName}}{{{split}}}{{/urlVars}}) {
    {{#responseValue}}
    {{#responseEntity}}
    {{#pageResult}}
        return Result.success(PageVo.getMockPageList({{{pageResponseEntity}}}.class));
    {{/pageResult}}
    {{^pageResult}}
        return Result.success(DataUtil.build({{responseEntity}}.class));
    {{/pageResult}}
    {{/responseEntity}}
    {{^responseEntity}}
        return Result.success();
    {{/responseEntity}}
    {{/responseValue}}
    }

{{/methods}}

}